<?php

/**
 * Represents a mobile html page.
 * Each Z_Mobile contains N Z_Mobile_Page
 */
class UI_MobilePage {

    private $pages;

    public function __construct() {
	$this->pages = array();
    }

    protected function createPage($title="", $id="") {
	if (!isset($this->pages)) {
	    $this->pages = array();
	}

	$p = new Z_Mobile_Page($title, $id);
	$this->pages[] = $p;
	return $p;
    }

    public function render() {



	$r = "";

	foreach ($this->pages as $page) {

	    if (Z_App::getConf()->debug->dumpObjects == true) {
		var_dump($page);
		echo "<br><br>";
	    }

	    $r .= $page->render();
	}



	return $r;
    }

    protected function getUrl($class, $parameters="") {
	//TODO: folders...
	return "index.php?p=$class";
    }

    /**
     * Try get values from post form and fill the properties in the class
     */
    public function fillValues() {
	foreach ($_POST as $key => $value) {
	    $this->$key = $value;
	}
    }

}

?>
